#ifndef __CUDA_HELPER__
#define __CUDA_HELPER__
#include "cuda_runtime.h"
#include <stdio.h>
#include <stdlib.h>

namespace CudaTraining
{
	static void HandleError(cudaError_t p_err, 
							  const char *p_file,
							  int p_line)
	{
		if (p_err != cudaSuccess)
		{
			printf("%s in %s at line %d", cudaGetErrorString(p_err), p_file, p_line);
			exit(EXIT_FAILURE);
		}
	}

#define HANDLE_ERROR(err)(HandleError(err, __FILE__, __LINE__))
}

#endif // !__CUDA_HELPER__
